Unexcept `.dylib` load fail on macOs · Issue #7582 · pyinstaller/pyinstaller · GitHub 您所在的位置:网站首页 load fail Unexcept `.dylib` load fail on macOs · Issue #7582 · pyinstaller/pyinstaller · GitHub

Unexcept `.dylib` load fail on macOs · Issue #7582 · pyinstaller/pyinstaller · GitHub

#Unexcept `.dylib` load fail on macOs · Issue #7582 · pyinstaller/pyinstaller · GitHub| 来源: 网络整理| 查看: 265

datas += [(path.join( './.venv/Lib/site-packages' if plat == 'windows' else './.venv/lib/python3.9/site-packages', 'torchaudio' ), 'torchaudio')]

That's what happens when you collect everything as data files... the shared libs do not undergo path rewriting, and you end up with potentially invalid paths.

But first, since you're trying to use torch on macOS, you should take a look at pyinstaller/pyinstaller-hooks-contrib#375 and resolve the torch library duplication (otherwise you'll end up with segmentation fault later on):

ls libtorch* libtorch.dylib libtorch_cpu.dylib libtorch_python.dylib

These files need to be removed and replaced with symlinks to copies in torch/lib directory:

rm -f libtorch* ln -s torch/lib/libtorch.dylib . ln -s torch/lib/libtorch_cpu.dylib . ln -s torch/lib/libtorch_python.dylib .

Similarly, you need to create a symlink to torchaudio/lib/libtorchaudio.so in the top-level directory (that's because torchaudio extensions DID get processed as binaries, and had their path rewritten to expect the library in top-level directory):

ln -s torchaudio/lib/libtorchaudio.so .

Lastly, change the rpath on libtorchaudio.so to find other torch libraries (here, we do not replace the rpath, but add a new one that points to the application top-level directory, relative to the library's location):

install_name_tool -add_rpath @loader_path/../.. torchaudio/lib/libtorchaudio.so

That should get you past the dynlib/dll error.

There's couple of other things I noticed:

you don't pack ffmpeg binary with your application, but you probably should? Unless you expect the user to have ffmpeg available in their environment?

downloading the models seems to fail with the following error:

traceback

./autocut -t ../big_buck_bunny_1080p_h264.mov None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used. [autocut:transcribe.py:L38] INFO Transcribing ../big_buck_bunny_1080p_h264.mov [W NNPACK.cpp:53] Could not initialize NNPACK! Reason: Unsupported hardware. [autocut:transcribe.py:L91] INFO Done voice activity detection in 30.4 sec Traceback (most recent call last): File "urllib/request.py", line 1346, in do_open File "http/client.py", line 1285, in request File "http/client.py", line 1331, in _send_request File "http/client.py", line 1280, in endheaders File "http/client.py", line 1040, in _send_output File "http/client.py", line 980, in send File "http/client.py", line 1454, in connect File "ssl.py", line 501, in wrap_socket File "ssl.py", line 1041, in _create File "ssl.py", line 1310, in do_handshake ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "autocut.py", line 6, in File "autocut/main.py", line 96, in main File "autocut/transcribe.py", line 52, in run File "autocut/transcribe.py", line 97, in _transcribe File "whisper/__init__.py", line 99, in load_model checkpoint_file = _download(_MODELS[name], download_root, in_memory) File "whisper/__init__.py", line 46, in _download with urllib.request.urlopen(url) as source, open(download_target, "wb") as output: File "urllib/request.py", line 214, in urlopen File "urllib/request.py", line 517, in open File "urllib/request.py", line 534, in _open File "urllib/request.py", line 494, in _call_chain File "urllib/request.py", line 1389, in https_open File "urllib/request.py", line 1349, in do_open urllib.error.URLError:

If you want to use certifi for your SSL, you probably need to add something like

import os import sys import ssl # Use certificate from certifi only if cafile could not find by ssl. if getattr(sys, 'frozen', False) and ssl.get_default_verify_paths().cafile is None: os.environ['SSL_CERT_FILE'] = os.path.join(sys._MEIPASS, 'certifi', 'cacert.pem')

at the top of your entry-point script. Long ago, this used to be done by run-time hook for certifi, which has siince been removed (pyinstaller/pyinstaller-hooks-contrib#335), so you need to do it yourself.

This warning, None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used., likely means that you need to copy metadata for torch if you want to use transformer models.


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有